UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qgNNVbB3WCTKriVFxpL9BbWw2AY36AirQUY1q+Avoo0='
WHERE
key_id = '25ea8ad8651ec59d7477ae08cbe1403ad337b551a794d7dcfc3275d009a05c97'
AND (
token = 'qgNNVbB3WCTKriVFxpL9BbWw2AY36AirQUY1q+Avoo0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)