UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P8u489a+LoirZ6T0vOSgYBmkfYN627rO5dfhFYrY8b8=' 
WHERE 
  key_id = 'f2a29974874b5bfa48c6717a7b757481f2cd34837cb8fb53a19fd93f968c8198' 
  AND (
    token = 'P8u489a+LoirZ6T0vOSgYBmkfYN627rO5dfhFYrY8b8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031