UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MDEd8kAhI1HM27YSs46pg6eBK3hUEVgTS02xQv4Vv1A='
WHERE
key_id = 'aa9c3fd2b8193ad0a6291edf1f28746ffb2e0cd607688a4a094d413e71e73a0b'
AND (
token = 'MDEd8kAhI1HM27YSs46pg6eBK3hUEVgTS02xQv4Vv1A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)