UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sjGFJPY+1Pa3bLEa9FrYc+1ioL2O3uvdRGXh+BcHUlg=' 
WHERE 
  key_id = '3fd2d90213b17c637164d0adc7868dd684691d5ba2a386311d72d457172692ce' 
  AND (
    token = 'sjGFJPY+1Pa3bLEa9FrYc+1ioL2O3uvdRGXh+BcHUlg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034