UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'beN2o+JvdX+M5os/oxF2+vucqM/u9fcbKUtA0r1wnT4='
WHERE
key_id = '8e5a75d17c7b2207ed01cbe43fea27af6d9b3ed173d18f39a508bc871151a656'
AND (
token = 'beN2o+JvdX+M5os/oxF2+vucqM/u9fcbKUtA0r1wnT4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)