UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm7JwM1WLSKT/LeJn2GplvczKxDoFvY1QpQ+iONHxtMU='
WHERE
key_id = 'ca13ecda681eae143ae29b1d4692bb8e35242794c2d2fcf55a301c82825e4156'
AND (
token = 'm7JwM1WLSKT/LeJn2GplvczKxDoFvY1QpQ+iONHxtMU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)