UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Km8W5ZxgbncHvMNBraMPm6tNAxZQ6+3TMKQij09wP7k='
WHERE
key_id = 'a9e53b719285c8cc14921d53b2ca932a819e45cc0aa51c560399fab1c6035501'
AND (
token = 'Km8W5ZxgbncHvMNBraMPm6tNAxZQ6+3TMKQij09wP7k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)