UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BQra71fYxJFQhhSxmOmHztCaBDJMMHRAarK9m8XDs2Y=' 
WHERE 
  key_id = '882c264bce4418875bac3e07aff24b323c2c858c5fe89dec6ab71963edbc2cce' 
  AND (
    token = 'BQra71fYxJFQhhSxmOmHztCaBDJMMHRAarK9m8XDs2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027