UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0g/UBXYK524gQ98Mn4PDW9uGuKvXIVw29ko6rZEAWM0='
WHERE
key_id = 'b2f4228a738f9638087f34d58a0c8d535e535b539f6993d3d842f11ba5ec539e'
AND (
token = '0g/UBXYK524gQ98Mn4PDW9uGuKvXIVw29ko6rZEAWM0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)