UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x4S4xkNqEBX660fFeRexQyFFy1oGLmAfmeKHoWGgyZU='
WHERE
key_id = '768410f4863da048ca73469b5db3ac5e607e7b471b9c1c50c632565f0f74916d'
AND (
token = 'x4S4xkNqEBX660fFeRexQyFFy1oGLmAfmeKHoWGgyZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)