UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ARk3gsWf36o/YOAQL6+Ad+R6hLfVSMRzes99gizyse8='
WHERE
key_id = 'acfbf5cc9c3de49164d8169fc3421c9331311f77168d7c7e8481eb74a572bf8b'
AND (
token = 'ARk3gsWf36o/YOAQL6+Ad+R6hLfVSMRzes99gizyse8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)