UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J9dSni4uHAI374Df2c5yHFf7p0e0kwj3eb+NAwp9aGo='
WHERE
key_id = '335e0c45f734e2179c63511da56adf0b598758f649fbd49aa505f6a7e43a8d60'
AND (
token = 'J9dSni4uHAI374Df2c5yHFf7p0e0kwj3eb+NAwp9aGo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)