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