UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OzCSwULaqyomh7Dm6tHyUtyAI7cG6IzISrqmSZsUc+Y=' 
WHERE 
  key_id = '54498abe2b06baff125636bf6eddbbc27a180c296122b732f47b21ec75e47e94' 
  AND (
    token = 'OzCSwULaqyomh7Dm6tHyUtyAI7cG6IzISrqmSZsUc+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019