UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kBm+QfM7Eu2ALtMHNu+U2abf0W+ochxFnzkHrG+S0Bo='
WHERE
key_id = 'edeb05464a8b2f1e60af41179501014da648b396f1b93090d6c3e7fb3c37cb27'
AND (
token = 'kBm+QfM7Eu2ALtMHNu+U2abf0W+ochxFnzkHrG+S0Bo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)