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