UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YwpFIoSgqzuNNCCSIZDbjQYQgKMpXKP4YuQs2JTNRU4='
WHERE
key_id = '40ed00bface30a835abef87999cce30b42964eff9fc4d89a9751794dce2181ed'
AND (
token = 'YwpFIoSgqzuNNCCSIZDbjQYQgKMpXKP4YuQs2JTNRU4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)