UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dmE9XV/Z3uz8inGfYuUSZsYcQSFAjda7C09pcL3zSBw='
WHERE
key_id = 'a1598daa18b59e1c6c8a46bb719c8407229d8aba85d8af12c439d6f0916262f0'
AND (
token = 'dmE9XV/Z3uz8inGfYuUSZsYcQSFAjda7C09pcL3zSBw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)