UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xS8HhmB2HJaACMs+aU2ifK6U6lSwiRHralUjyYmvzX8='
WHERE
key_id = 'e9257dd075643938eb9713c03a8a2f1872ac9eea70df91bd69cd5c21c9c92674'
AND (
token = 'xS8HhmB2HJaACMs+aU2ifK6U6lSwiRHralUjyYmvzX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)