UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cc9j7yqPBtPefA1NLeB6ma0LGNupZhKoi0vKbFcdIYQ='
WHERE
key_id = 'a5a21c48b8d7bbf2e4f1e5f25fdfde64497167bcaf92dc254baff304a2d62039'
AND (
token = 'cc9j7yqPBtPefA1NLeB6ma0LGNupZhKoi0vKbFcdIYQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)