UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AI9atrQB0Qv1/9CcNoaJ02MAnrkY7hhCOfam1Q0X9iY='
WHERE
key_id = '54a2024758c287a51f2397d0bb73db6648a566405d27fe16c96c649b241c0e05'
AND (
token = 'AI9atrQB0Qv1/9CcNoaJ02MAnrkY7hhCOfam1Q0X9iY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)