UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gmE4HnKDEGzyN2jr7ZuzJtKh56pfE8/8k4sINIrnsC4='
WHERE
key_id = '30264e115db72bdb25f5abc3b390d702c2d57d1699b8652b41ee76b330ceb07a'
AND (
token = 'gmE4HnKDEGzyN2jr7ZuzJtKh56pfE8/8k4sINIrnsC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)