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