UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GiBfjUjMHg6087yN3kE2zP+cfe8SrdQSVhvieUKEc1U='
WHERE
key_id = 'de16d2a03f22f6a0a52562e96d9570e11a3fc32a162907822618c22762d7b912'
AND (
token = 'GiBfjUjMHg6087yN3kE2zP+cfe8SrdQSVhvieUKEc1U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)