UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sDI7p1NsDskUZygxRQKsdCIjj0KU2q63wAf0Xq6ARp0='
WHERE
key_id = '3a85f754793140fa33ba6483511fe082bf153bdee62f4cb05b70e6f17479b6c9'
AND (
token = 'sDI7p1NsDskUZygxRQKsdCIjj0KU2q63wAf0Xq6ARp0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)