UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mm14f8VS7muNw7dtjDnKSKs03Gmn8QgDHxZhraX8ttE='
WHERE
key_id = '8e399bb7b0ee7d019bef7928574f9cefbfa3efac079738f035b5433422d0d632'
AND (
token = 'mm14f8VS7muNw7dtjDnKSKs03Gmn8QgDHxZhraX8ttE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)