UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OCfpTgn28XMyXxVIU1AXFITnwGI9ooVqoGqptUCdZHA=' 
WHERE 
  key_id = '9da9ad423ebc3227959b799de8dd5d5727047d1a10b603f95bcdf7d8a604f162' 
  AND (
    token = 'OCfpTgn28XMyXxVIU1AXFITnwGI9ooVqoGqptUCdZHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028